<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
		<title>职工管理</title>
		<link rel="stylesheet" href="layui2/src/css/layui.css" media="all">
		<script src="layui2/src/layui.js"></script>
		
		<script src="js/jquery-3.3.1.min.js"></script>
		<script src="js/cpexcel.js"></script>
		<script src="js/shim.js"></script>
		<script src="js/jszip.js"></script>
		<script src="js/xlsx.js"></script>
		
	
	</head>
	<style>
		.a-upload {
		  position: relative;
		    display: inline-block;
		
		    border: 1px solid #99D3F5;
		
		    overflow: hidden;
		
		    text-decoration: none;
		    text-indent: 0;
		}
		.a-upload  input {
		    position: absolute;
		    font-size: 20px;
		    right: 0;
		    top: 0;
		    opacity: 0;
		
		}
		
		.a-upload:hover {
		     background: #AADFFD;
		    border-color: #78C3F3;
		    color: #004974;
		    text-decoration: none;
		
		}
		.layui-table-edit{
	    border-color: blue;
	    outline: 0;
			
	   /* -webkit-box-shadow: inset 0 1px 1px  red,0 0 8px  yellow;
	    box-shadow: inset 0 1px 1px  red,0 0 8px  yellow; */
	}
	.layui-table[lay-even] tr:nth-child(even){background-color:skyblue}
	/* //even:true  开启隔行样式 */
	
	.layui-table{width:100%;background-color:white;color:black;font-size: 25px;}
	.layui-table tbody tr:hover,.layui-table-hover{background-color:orange}
	
	
body .demo-class .layui-layer-title{background:darkorange; color:#fff; border: none;}
body .layui-layer-title{background:darkorange; color:#fff; border: none;}

body .demo-class .layui-layer-btn{border-top:1px solid #E9E7E7}
body .demo-class .layui-layer-btn a{background:blueviolet;}
body .demo-class .layui-layer-btn .layui-layer-btn1{background:#999999;}


.content{
   		outline-style: none ;
   		    border: 0px solid #ccc;
   		    bordHer-radius: 3px;
   		    /* font-size: 20px; */
               width: 100%;
   		padding:5px 0px; 
           margin: -10px 0px;
   		color: blue;
   	}
   
   .content2{
       /* border-color: red; */
       outline: 0;
	    border:1px solid #96c2f1;background:#eff7ff;
      /* -webkit-box-shadow: inset 0 1px 1px  darkturquoise,0 0 8px  darkorange;
       box-shadow: inset 0 1px 1px  darkturquoise,0 0 8px  darkturquoise; */
   }
</style>
	<body >
		<div style="margin-top: 3%;margin-left: 2%;margin-right: 3%;">

		<script type="text/html;text/javascript" id="toolbarDemo">

			<div class="layui-btn-container layui-inline">
	<button class="layui-btn layui-btn-danger" lay-event="deleteSome"><i class="layui-icon"></i>删除</button>
	<button class="layui-btn " onclick="add()"><i class="layui-icon"></i>添加</button>

	<button class="layui-btn " id="bianji" onclick="update()">编辑</button>
		<button class="a-upload layui-btn" onclick="daochu()">
			导入
		</button>
	
		<button class="layui-btn"  lay-event="daochu" id="chu">导出</button>
	
	 
	 {{# if(d.checkStatus) {}}
	 {{# } }}
	 {{# if(d.id === 'demo'){ }}

	
	 {{# } }}
	
	 
	 <span class="layui-btn" style="padding:0%;width: 10%;margin-left: 0;" >
		 <input type="text" name="username" placeholder="关键字"  class="layui-input" style="width: 100%;">
	 </span>
	 <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
	 
	  <button class="layui-btn" lay-event="reload"  style="margin-left: 0;" id="rad" >刷新</button>
	  
	  
		
	 <!-- </div> -->
	
  </div>
  
	</script>
	<span class="a-upload layui-btn" style="Display:none;">

		<input type="file" name="xlfile" id="xlf" >导入

	</span>
	
		<table class="layui-hide" lay-id="demo2" lay-filter="test" id="test"></table>
 
		<script type="text/html" id="sel_update_time">
			<input type="password" name="date" id="sel_create_date{{d.id}}" value="{{d.password}}"  class="layui-table-cell  pass" style="position: absolute;right: 0;top: -20%;bottom: 0%;left: 0;width: 100%;height: 155%;border-width: 0;padding-left: 5%; background-color:white" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')" onchange="onChangeTest(this)" >
</script>
		<script type="text/html" id="ac_id3">
		<input type="text" id="{{d.id}}:id" class="content" value="{{d.ac_id}}"    onchange="change(this)" readonly onchangeValue=""/>
	</script>
	<script type="text/html" id="account3">
		<input type="text" id="{{d.id}}:ac" class="content" value="{{d.account}}"    onchange="change(this)" readonly onchangeValue=""/>
	</script>
	<script type="text/html" id="password3">
		<input type="password" id="{{d.id}}:pwd" class="content password3" value="{{d.password}}"    onchange="change(this)" readonly onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9]/g,'')">
	</script>
	<script type="text/html" id="tel3">
		<input type="text" id="{{d.id}}:tel" class="content" value="{{d.tel}}"    onchange="change(this)" readonly >
	</script>
	<script type="text/html" id="zhiwu3">
		<input type="text" id="{{d.id}}:duty" class="content" value="{{d.duty}}"    onchange="change(this)" readonly >
	</script>
	<script type="text/html" id="switchTpl">
  <!-- 这里的 checked 的状态只是演示 -->
  <input type="checkbox"  disabled="disabled" class="checkbox2" name="sex" value="{{d.id}}" lay-skin="switch" lay-text="女|男" lay-filter="sexDemo" {{ d.sex == '女' ? 'checked' : '' }}>
</script>
<!-- // <div class="layui-table-cell laytable-cell-radio" lay-filter="selFilter">   <!-- </div> --> 

<script type="text/html" id="zhiwu">
	 
            <select class="select2" onchange="cha(this)" >
			
			{{#  var ap=["普通职工","辅导员","导师","年级主任"];
			var ap2=[]; 
			ap2.push(d.duty) ;
			var ap3=ap.filter(function(v){ return ap2.indexOf(v) == -1 });
			
			 }}
			
			<option value="{{d.duty}}" >{{d.duty}}</option>
			{{# for(var p=0;p<ap3.length;p++) { }}
			<option value="{{ap3[p]}}" >{{ap3[p]}}</option>
			 {{# } }}
            </select>
			
			 {{# $(".select2").removeAttr("disabled");console.log("----"); }}

   </script>
   
	<script type="text/html" id="zhiwu2">
	  <select class="select2" onchange="ch(this)" >
	 
	 {{#  var ap=["普通职工","辅导员","导师","年级主任"];
	 var ap2=[]; 
	 ap2.push(d.duty) ;
	 var ap3=ap.filter(function(v){ return ap2.indexOf(v) == -1 });
	 
	  }}
	 
	 <option value="{{d.duty}}" >{{d.duty}}</option>
	 {{# for(var p=0;p<ap3.length;p++) { }}
	 <option value="{{ap3[p]}}" >{{ap3[p]}}</option>
	  {{# } }}
	 </select>
	 
	  {{# $(".select2").removeAttr("disabled");console.log("----"); }}
	</script>
	
		
		</div>
		
		<script type="text/javascript">
	
	
			
				
				var id_ac=[];
				 count=[];
			function change(event){
				// alert("r:"+event.value+" "+event.id)
				var arr_e=event.id.split(":")
				// alert('dg:'+typeof(arr_e[0])+" "+arr_e[1]+" "+event.value)
				
				var choid=parseInt(arr_e[0])
				var kp="";
				switch(arr_e[1]){
					case "ac":
					kp="account";
					break;
					case "pwd":
					kp="password";
					break;
					case "tel":
					kp="tel";
					break;
					case "sex":
					kp="sex";
					break;
					case "id":
					kp="ac_id";
					break;
					default:
					break;
				}
					
					// alert('d:'+choid+" "+kp)
			
				function objFn(obj, objIndex, objs) {
					if (obj.id == choid)
						return obj.id;
			
				}
				
				var wpw = data_json.findIndex(objFn);
				// alert("wp:"+wpw+" "+count.indexOf(wpw))
				data_json[wpw][kp]=event.value;
				if(count.indexOf(wpw)==-1){
					id_ac.push(choid);
					count.push(wpw);
				}
				
				
				console.log(data_json[wpw])
				
				
	
				
				// if(ge.indexOf(event.id)==-1)
				// ge.push(event.id)
				// alert("d:"+ge.toString()+" "+event+" "+$("#"+event).val())
// 				
			}
			
			
				function update(){
				
				
			
				// $("tbody").find("tr").eq(0).css("background-color","red");

					var str=$("#bianji").text();
					if(str=="编辑"){
						$(".checkbox2").removeAttr("disabled") //启用
						$(".select2").removeAttr("disabled")
						$(".password3").removeAttr("type");
						 $(".content").removeAttr('readonly')
						$(".content").addClass('content2',true)
						$("#bianji").text("保存")
					}else{
						alert("su:"+count.toString()+" "+id_ac.toString()+" "+typeof(count))
						var arr_show=[];
						for(var i in count){
							// alert("i:"+count[i])
							arr_show.push(data_json[count[i]])
						}
						
						console.log(arr_show)
						if(count.length>0)
   $.post("http://119.126.159.221:86/HBuilder/xops/Back.php",{
					     
					     type:"Teacher",
						 operation:"update",
					     account:arr_show,
						 password:id_ac,
						
						 token:"1ab66e59325257b60b971d4afa1505ce"
					     
					   },function(data,status){
						   // alert("data:"+data)
						   obj=JSON.parse(data);
						   if(obj.code==200)
						   {
							layer.msg('更新成功！', {
								icon: 6
							});
						   }else{
							   layer.msg('更新失败！', {
							   	icon: 5
							   });
						   }
						   })
						   
						 count=[];
						 id_ac=[];
						 $(".checkbox2").attr("disabled","disabled")
						 $('.select2').attr("disabled","disabled");
						 $(".password3").attr("type","password")
						 $(".content").removeClass('content2')
							 $(".content").attr("readonly","readonly")
						$("#bianji").text("编辑")
					}
				
				
			}
			
			function onChangeTest(changeVal) {
				var val = parseInt(changeVal["attributes"][1]["value"].substring(15, changeVal["attributes"][1]["value"].length));

				function objFn(obj, objIndex, objs) {

					if (obj.id == val)
						return objs;

				}
				
			
				var neww = changeVal.value;
				// var old=changeVal.defaultValue;


				layui.use(['table'], function() {
					var table = layui.table;

					bo = ($("#img").attr("src") == "images/look_p2.png");
					// alert("bo:"+bo)
					if (neww.length < 6) {
						table.reload('test', {
							data: data_json
						});
						if (bo) {
							$("#img").attr("src", 'images/look_p2.png');
							$(".pass").removeAttr("type")
						}
						layer.msg("密码不能少于6个字符！", {
							icon: 4
						});
					} else if (neww.length > 16) {
						table.reload('test', {
							data: data_json
						});
						if (bo) {
							$("#img").attr("src", 'images/look_p2.png');
							$(".pass").removeAttr("type")
						}
						layer.msg("密码不能超过16个字符！", {
							icon: 4
						});
					}
				})
				var wpw = data_json.findIndex(objFn);
				alert("p:"+data_json[wpw]["account"])
				$.post("http://119.126.159.221:86/HBuilder/xops/Back.php", {
					type: "Teacher",
					operation: "update",
					account: data_json[wpw]["account"],
					password: "password",
					tel: neww,
					token: "1ab66e59325257b60b971d4afa1505ce"
				}, function(data, ss) {
					// alert("data:"+data)
					var obj = JSON.parse(data);
					if (obj.code == 200) {
						layer.msg('更新成功！', {
							icon: 1
						});
					} else {
						layer.msg('更新失败！', {
							icon: 1
						});
					}
				})


			}

			function wm() {

				if ($("#img").attr("src") == "images/look_p1.png") {
					$("#img").attr("src", 'images/look_p2.png');
					$(".pass").removeAttr("type")

				} else {
					$("#img").attr("src", 'images/look_p1.png');
					$(".pass").attr("type", "password");
				}

			}

		

			
	


			data_json = "";
			resc = 1;

			$.post("http://119.126.159.221:86/HBuilder/xops/Back.php", {
				type: "Teacher",
				operation: "search",
			
				token: "1ab66e59325257b60b971d4afa1505ce"
			}, function(data, status) {
				// alert("data:"+(data));
				data_json = JSON.parse(data);
				data_json = data_json["data"];
				

			})
			layui.config({
				base: 'test/js/'
			}).use(['testTablePlug2'], function() {
				var $ = layui.jquery,
					layer = layui.layer //弹层
					, form = layui.form //弹层
					,
					table = layui.table //表格
					,
					tablePlug = layui.tablePlug; //表格插件

				tablePlug.smartReload.enable(false);
layer.config({
  skin: 'demo-class'
})			// 处理操作列
				var fn1 = function(field) {
					return function(data) {
						return data[field];
					};
				};



				table.render({
					// elem: '#demo2'
					elem: '[lay-id="demo2"]'
						// , height: 'full-200'
						// , url: 'json/data11.json' //数据接口
						,
					data: data_json

						,
					title: '用户表',
					page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
						layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'] //自定义分页布局
							,
						curr: 1 //设定初始在第 5 页
							,
						groups: 5 //只显示 1 个连续页码
							,
						first: true //不显示首页
							,
						last: true //不显示尾页

					},
					// even:true
					// , page: false
					// ,
					text: {
						none: '无数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
					},
					limit: 10,
					loading: true,
					limits: [10, 20, 40, 80],
					toolbar: '#toolbarDemo' //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
						// , totalRow: true //开启合计行
						,
					cellMinWidth: 90
						// , autoSort: false // 不进行前端排序
						,
					done: function(res, curr, count) {

						var tableView = this.elem.next();
						var totalRow = tableView.find('.layui-table-total');
						var limit = this.page ? this.page.limit : this.limit;
						layui.each(totalRow.find('td'), function(index, tdElem) {
							tdElem = $(tdElem);
							var text = tdElem.text();
							if (text && !isNaN(text)) {
								text = (parseFloat(text) / limit).toFixed(2);
								tdElem.find('div.layui-table-cell').html(text);
							}
						});
						if ($("#img").attr("src") == "images/look_p2.png") {
							$(".pass").removeAttr("type")

						}
						resc = curr;
						if($("#bianji").text()=="保存"){
							table.reload('test', {
								data: data_json,
							
							});
						}
						
						console.log("res:", res);

						//得到当前页码
						console.log("curr", curr," ",$("#bianji").text());

						//得到数据总量
						console.log("co", count);


					},
					parseData: function(ret) {
							return {
								code: ret.code,
								// msg: ret.msg,
								count: ret.count,
								data: ret.data
							}
						}
						// 定制当前数据的主键字段，默认为id，
						,
					primaryKey: 'id'
						// 是否开启复选列状态记录 支持true/false/{} true的情况下primaryKey默认为id，default默认为[]
						// primaryKey: 'username', // 可以定义成其他的字段，但是有一个要求，就是这个字段的值必须有唯一性约束，这个是一个判断记录是否相同重要的条件
						,
					checkStatus: {
						// 原始已经选中的记录的主键值集合
						default: []
					},
					checkDisabled: {
						enabled: true,
						data: []
					},
					cols: [
						[{
								type: 'numbers',
								// fixed: 'left',
								title: '序号',
								minWidth:50, 
								width:"4%",

							},
							{
								type: 'checkbox',
							
								// fixed: 'left',
								minWidth: 40,
								width:"4%",

							}, {
								field: 'id',
								title: 'ID',
							width:"7%",
								align:"center",
								unresize: true,
								sort: true,

								// fixed: 'left',
								minWidth: 60,
								// minWidth: 500,
								

							}, {
								// field: 'account',
								// title: '职工名',
								// minWidth: 120,
								// width: '15%',
								// edit: 'text',
								// fixed: 'center',
								// minWidth: "10%",
								// toolbar: '#account3',
								field: 'account',
								title: '职工名',									            align:"center",				
								width:'15%',
			
								minWidth: 120,
								sort: true,
								 templet: '#account3',
								  unresize: true

							},
							{
								// field: 'password',
								// title: '密码',
								// width: '15%',
								// minWidth: 120,
								// edit: 'text',
								// fixed: 'center',
								// sort: true,
								// minWidth: "10%",
								// toolbar: '#password3',
								field: 'password',
								title: '密码',
								align:"center",					
								width:'17%',

								minWidth: 120,
								sort: true,
								 templet: '#password3',
								  unresize: true
							},

							{
								field: 'tel',
								title: '电话',
								width: '13%',
								minWidth: 120,
								edit: 'text',
								align:"center",
								sort: true,
								minWidth: "10%",
								toolbar: '#tel3',
							},
							{
								field: 'sex',
								title: '性别',
								align:"center",
								width:"5%",
							
								// fixed: 'right',
								minWidth: 60,
								sort: true,
								 templet: '#switchTpl',
								  unresize: true
							
							},
							{
								field: 'ac_id',
								title: '职工id',
								 type: 'toolbar',
								width:'12%',
								edit: 'text',
								// fixed: 'right',
								align:"center",
								sort: true,
								  toolbar: '#ac_id3',

							},
							
							{
							
								field: 'duty',
								title: '职务',
								align:"center",
								width:'8%',
								edit: 'text',
								// fixed: 'right',
								// minWidth: 120,
								sort: true,
								toolbar:"#zhiwu3",
								
							
							},
							 {
								field: 'time',
								title: '注册时间',
								align:"center",
								width:'15%',
								// edit: 'text',
								// fixed: 'right',
								// minWidth: 120,
								sort: true,
							rowspan:2,
							}

							
							
// 							,{
// 							    fixed: 'right',
// 							    type: 'toolbar',
// 							    field: 'toolbar_common',
// 							    title: '操作1',
// 							    width: 190,
// 							    align: 'right',
// 							    toolbar: '#barDemo',
// 							    // rowspan: 2
// 							  }
// 

						]
					]
				});
					 form.on('switch(sexDemo)', function(obj){
						 var choid=parseInt(this.value);
				function objFn(obj, objIndex, objs) {
					if (obj.id == choid)
						return obj.id;
							
				}
				var wpn=data_json.findIndex(objFn);
			// alert("2:"+obj.elem.checked)
				if(obj.elem.checked)
				var kp="女";
				else
				var kp="男";
					// alert(wpn+" "+kp)
				if(count.indexOf(wpn)==-1){
					count.push(wpn);
					id_ac.push(choid)
				}
				
				data_json[wpn]["sex"]=kp;
    // layer.tips(this.value + ' = ' + this.name + '：'+ obj.elem.checked, obj.othis);
	   console.log("【】",data_json[wpn])
  });
  
				$(document).on('click', '.layui-table-view .layui-table-body tr', function(event) {
					var trElem = $(this);
					var tableView = trElem.closest('.layui-table-view');
					tableView.find('.layui-table-body tr.table_tr_click').removeClass('table_tr_click');
					tableView.find('.layui-table-body tr[data-index="' + trElem.data('index') + '"]').addClass('table_tr_click');
				})

			});


			function GetValue(data) {

// 				data_json.push(data);
// 				layui.use('table', function() {
// 					var table = layui.table;
// 					table.reload('test', {
// 						data: data_json,
// 
// 					});
// 				});
				$("#rad").click();

			}

			function add() {
				layer.open({
					type: 2,
					title: '添加职工数据',
					shadeClose: true,
					shade: false,
					maxmin: true, //开启最大化最小化按钮
					anim: 2, //动画从下到上
					offset: 'auto',
					resize :true,
					resizing :true,
					area: ['600px', '600px'],
					content: 'html/admin-add.html'
				});
			}
		</script>
			<script>
				;
				function daochu(){
					$('#xlf').trigger("click");
				}
			
		
			var X = XLSX;
			var XW = {
				/* worker message */
				msg: 'js/xlsx',
				/* worker scripts */
				worker: 'js/xlsxworker.js'
			};
		
			var global_wb;
		     
			var process_wb = (function() {
		
		
				function get_format() {
					return "json";
				}
	
				var to_json = function to_json(workbook) {
					var result = {};
					workbook.SheetNames.forEach(function(sheetName) {
		
						var roa = X.utils.sheet_to_json(workbook.Sheets[sheetName], {
							header: 1
						});
						// alert("dd:"+sheetName+" "+roa.length)
						if (roa.length) result["data"] = roa;
					});
					// alert("hh:"+result.data);
					   p_test=0;
					arr_in = [];
					title = ["职工名", "密码", "电话","性别","职工id","职务"];
				
						arr_bj=[]
					res_str = "[";
					var uid = 0;
					var	pid = 0;
					var	tid = 0;
					var sid = 0;
					var aid = 0;
					var did = 0;
					for (var i in result) {
		
						for (var j in result[i]) {
		
							console.log("tt:", i, "--", j, "--", result[i][j])
							for (var z in result[i][j]) {
								if (j == 0) {
									for (var k in result[i][0]) {
										arr_in.push(result[i][0][k])
										switch (result[i][0][k]) {
											case "职工名":
												uid = k;
												break;
											case "密码":
												pid = k;
												break;
											case "电话":
												tid = k;
												break;
											case "性别":
												sid = k;
												break;
											case "职工id":
												aid = k;
												break;
											case "职务":
												did = k;
												break;
											default:
												break;
										}
										// console.log(" gggg ", uid, " ", pid, " ", tid, " ", "::", result[i][0])
		
									}
									break;
		
									// console.log(" gggg ", z, "::", result[i][0])
								}
								// console.log(i, "  ", j, "  ", z, "::", result[i][j][z])
								if (j > 0) {
									res_str += "{\"account\":\"" + result[i][j][uid] + "\",\"password\":\"" + result[i][j][pid] +
										"\",\"tel\":\"" + result[i][j][tid] + "\",\"sex\":\"" + result[i][j][sid] + "\",\"ac_id\":\"" + result[i][j][aid] + "\",\"duty\":\"" + result[i][j][did] + "\"},"
								}
		
								// alert("vv:"+" "+j+" "+z+" "+result[i][j][z])
								break;
		
		
							}
						}
		
					}
					res_str = res_str.substr(0, res_str.length - 1) + "]";
					// alert("str:" + res_str)
					result_str = JSON.stringify(result, 2, 2);
		           
					 
					// alert(res_str)
					var c = isContained(arr_in, title);
				
					// alert("rre:" + arr_in.join(",") + "==" + arr_bj.join(",")+"--")
					if (!c) {
						// alert("缺少标题栏：" + arr_bj.join(" "))
					layer.alert("缺少标题栏：" + arr_bj.join(","), {icon: 0}); 
					     p_test=1; 
					} else {
							// alert("u:"+res_str)
						userData=JSON.parse(res_str);
					
						 layui.sessionData('test', {
						  key: 'teachername'
						  ,value: userData
						});
					
							
				
					layui.use(['layer'], function() {
						var layer = layui.layer;
		                   layer.open({
		                     type: 2,
							 title:"职工数据导入",
		                     area: ['725px', '500px'],
		                     fixed: false, //不固定
		                     maxmin: true,
							 	shadeClose: true,
							 shade: false,
		                     content: 'html/daoru-excelte.html',
		                   	
		                   
		                   });
						    });
						
					}
				
				
					return JSON.stringify(result['data'], 2, 2);
				};
		
		
		
				return function process_wb(wb) {
					global_wb = wb;
					var output = "";
		
					switch (get_format()) {
		
						case "json":
							output = to_json(wb);
							break;
		
					}
					console.log('da:'+output)
					
									
				};
			})();
		
		
		
			function isContained(aa, bb) {
				if (!(aa instanceof Array) || !(bb instanceof Array) || ((aa.length < bb.length))) {
					return false;
				}
				var aaStr = aa.toString();
				// alert("len:"+aaStr)
				for (var i = 0; i < bb.length; i++) {
		
					if (aaStr.indexOf(bb[i]) < 0) {
						arr_bj.push(bb[i])
					}
		
				}
				if (arr_bj.length > 0)
					return false;
				return true;
			}
		
			var do_file = (function() {
				var rABS = typeof FileReader !== "undefined" && (FileReader.prototype || {}).readAsBinaryString;
		
		
				return function do_file(files) {
					rABS = false;
					use_worker = false;
					var f = files[0];
					var reader = new FileReader();
					reader.onload = function(e) {
						if (typeof console !== 'undefined') console.log("onload", new Date(), rABS, use_worker);
						var data = e.target.result;
					
						if (!rABS) data = new Uint8Array(data);
						if (use_worker) xw(data, process_wb);
						else process_wb(X.read(data, {
							type: rABS ? 'binary' : 'array'
						}));
					};
					if (rABS) reader.readAsBinaryString(f);
					else reader.readAsArrayBuffer(f);
				};
			})();
		
		
		
			(function() {
				var xlf = document.getElementById('xlf');
				if (!xlf.addEventListener) return;
		
				function handleFile(e) {
					
					do_file(e.target.files);
					$("#xlf").val("");
					
				}
				xlf.addEventListener('change', handleFile, false);
				
			

			})();
			var _gaq = _gaq || [];
			_gaq.push(['_setAccount', 'UA-36810333-1']);
			_gaq.push(['_trackPageview']);
		</script>
	</body>
</html>
